
/**
 * Date:2019年5月31日下午2:23:05
 * Copyright (c) 2019, www.bwbroad.com All Rights Reserved.
 *
*/

package com.xue.im.common.vo;

import com.xue.im.common.IMUtil;

/**
 * Description: 消息 <br/>
 * Date: 2019年5月31日 下午2:23:05 <br/>
 * 
 * @author xuejianxin
 */
public class Message {
	private Header header;
	private Object body;

	public Header getHeader() {
		return header;
	}

	public void setHeader(Header header) {
		this.header = header;
	}

	public Object getBody() {
		return body;
	}

	public void setBody(Object body) {
		this.body = body;
	}

	public Object getOption(String key) {
		return header.getOptions().get(key);
	}

	public Message addOptions(String key, Object value) {
		this.getHeader().getOptions().put(key, value);
		return this;
	}
	
	public String getSender() {
		return (String) getOption(IMUtil.SENDER);
	}
	public String getRecevier() {
		return (String) getOption(IMUtil.RECEIVER);
	}
	

	@Override
	public String toString() {
		return String.format("Message %s, 【body】=%s", header, body);
	}

}
